<?php

class PageEventReport extends Page
{
	public function getHTML()
	{
		$html = $this->getHeaderHTML();

		$submitScript = new SubmitFormScript();
		$html .= $submitScript->getHTML();

		$script = new EditDeleteFormScript();
		$html .= $script->getHTML();

		$html .= $this->getBodyTopHTML();
		$html .= $this->getHiddenVariables();

		$datatable = new DataTable();
		$datatable->setParentPage($this);
		$datatable->setName("Events");
		$datatable->setValue("Events");
		$datatable->setEditable(true);
		$datatable->setDeletable(true);
		if(isset($_POST['ShowDeleted']))
			$datatable->showDeleted($_POST['ShowDeleted']);
		if(isset($_POST['ShowBefore']))
			$datatable->showBefore($_POST['ShowBefore']);
		if(isset($_POST['ShowAfter']))
			$datatable->showAfter($_POST['ShowAfter']);
		elseif((!isset($_POST['ShowBefore']))&&(!isset($_POST['ShowAfter'])))
			$datatable->showAfter(true);
		if(isset($_POST['ShowLocations']))
			$datatable->showLocations(true);
		if(isset($_POST['ShowEventInvolvees']))
			$datatable->showEventInvolvees(true);
		if(isset($_POST['ShowEventTypes']))
			$datatable->showEventTypes(true);
		$datatable->setDBTableName("Events");
		$datatable->setDatabase($this->Database);
		$datatable->setRenderer(new DataTableRendererHTMLList($datatable));
		$columns = array();
		$columns[] = new DataTableColumn("Start","Date","DateOnly");
		$columns[] = new DataTableColumn("Start","Start","TimeOnly");
		$columns[] = new DataTableColumn("End","End","TimeOnly");
		$columns[] = new DataTableColumn("Title","Title","");
		$columns[] = new DataTableColumn("Description","Description","");
//		$columns[] = new DataTableColumn("EventTypeID","Event Type","SingleEnumeration");
		$columns[] = new DataTableColumn("EventInvolvee","Event Involves ...","MultiEnumeration");
		$columns[] = new DataTableColumn("Location","Location","MultiEnumeration");
		$datatable->setColumns($columns);
		$datatable->setSQL("select EventID as ColumnID, Start, End, Title, Description, EventTypeID, DeletedBy FROM Events");
		$datatable->setOrderBy("Start");
		$html .= $datatable->getHTML();
		$html .= "<br>\n";

		$html .= $this->getBodyBottomHTML();
		return $html;
	}
}
?>